<?php
/*
 * 单页
 */
namespace app\admin\controller;
use think\Db;
class Message extends Comm
{
	public function index()
    {
        $list = db('message')->order('id desc')->select();
        $this->assign('list', $list);
        return $this->fetch();
    }
	
	
    //删除
    public function del()
    {
        $ids = input('param.');
        if ($ids) {
            if (is_array($ids)) {
				if (request()->isGet()){
					$ids = implode(',', $ids);
				}else{
					$ids = implode(',', $ids['ids']);	
				}
                $map['id'] = array('in', $ids);
            } else {
                $this->error('参数错误！');
            }
            if (db('message')->where($map)->delete()) {
                addlog('删除留言，ID：' . $ids);
                $this->success('恭喜，删除成功！',url('index'));
            } else {
                $this->error('参数错误！');
            }
        } else {
            $this->error('参数错误！');
        }
	}
	
	
}
